package com.ysyx.ysyx_admin.controller;

import com.ysyx.ysyx_admin.dto.BaseDto;
import com.ysyx.ysyx_admin.pojo.DriverPojo;
import com.ysyx.ysyx_admin.qo.DriverAuditQo;
import com.ysyx.ysyx_admin.service.DriverPojoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 *
 * @description: xxxx接口/类
 * @author:Lenovo
 * @create:2023/4/18 14:31
 */
@RestController
@RequestMapping("/driver")
public class DriverController {

    @Autowired
    private DriverPojoService driverPojoService;


    //司机信息表格展示
    @RequestMapping("/showDriver")
    public List<DriverPojo> showDriver(@RequestBody DriverPojo driverPojo) {
        System.out.println(driverPojo.getOffset());
        List<DriverPojo> driverPojos = driverPojoService.showDriver(driverPojo);
        System.out.println(driverPojos);
        return driverPojos;
    }

    //司机信息表格总条数
    @RequestMapping("/driverCount")
    public int driverCount() {
        int num = driverPojoService.driverCount();
        return num;
    }


    //司机审核表格展示
    @RequestMapping("/showDriverAudit")
    public List<DriverAuditQo> driverAudit(@RequestBody DriverAuditQo driverAuditQo) {

        List<DriverAuditQo> auditQos = driverPojoService.driverAudit(driverAuditQo);
        System.out.println(auditQos);
        return auditQos;
    }


    //司机审核表格总条数
    @RequestMapping("/driverAuditCount")
    public int driverAuditCount() {
        int num = driverPojoService.driverAuditCount();
        return num;
    }


    @RequestMapping("/passAudit")
    public BaseDto passAudit(@RequestBody DriverAuditQo driverAuditQo) {
        System.err.println(driverAuditQo.getDriverId());
        BaseDto baseDto = driverPojoService.passAudit(driverAuditQo);
        System.out.println(baseDto);
        return baseDto;
    }


    @RequestMapping("/noPassAudit")
    public BaseDto noPassAudit(@RequestBody DriverAuditQo driverAuditQo) {
        System.err.println(driverAuditQo.getDriverId());
        BaseDto baseDto = driverPojoService.noPassAudit(driverAuditQo);
        System.out.println(baseDto);
        return baseDto;
    }




}
